-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer JS over TS in extension resolve #9953
Conversation
prefer JS over TS in resolve so that node_modules that compile .ts and .js in the same directory load the compiled result.
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Legacy Client Bundles (polyfills)
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Legacy Client Bundles (polyfills)
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: 3a8b967 |
That sounds like a bug in the particular package (wrong publish). Also note that next does not compile node_modules, meaning you’re customizing webpack config to achieve that. Changing this will make resolving in typescript projects slower. |
@timneutkens every other framework (gatsby/create-react-app) resolves node_modules via JS not TS. this might not be the right fix, but it definitely feels like a bug somewhere in the pipeline. Within the typescript ecosystem its pretty common to compile your JS files along side your TS. just because you haven't happened to use a node_module which does this doesn't make it not valid. once its a node_module, (after compilation/published) it would seem pretty weird to consume TS. (which is currently happening) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems breaking, however, I wouldn't mind changing this in the future (Next 10).
@timneutkens also for the record, this wouldn't be an issue (for me) if styled-jsx worked in typescript alone, but since it doesn't I have to use babel to run the babel transforms to get the UI Kit I'm building to work correctly in different projects. |
Did a bunch more investigation into this and it seems that the TS compiler prefers I'll have to close this PR as it's fork has disappeared and I can't do a checkout for it. |
this fixes an issue when next.js is loading packages using typescript that compile their typescript code in-line with their .ts files.
e.g.
which would result in